package com.base.myproject.client.system;

import com.base.myproject.client.tools.SendServlet;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;

public class Logout {
	public Logout() {

	}

	void init() {

	}

	public  boolean  logout() {
		SendServlet send = new SendServlet();
		String str = send.getStringx("gwtbase/BaseServlet",
				"Action=logout");
		Document doc = XMLParser.parse((String) str);
		NodeList list = doc.getElementsByTagName("root");
		Node node = list.item(0);
		Element elem = (Element) node;
		if (elem.getAttribute("status").equals(Env.LOGOUTSUCCESS)) {

			Env.setUid(null);

		
				//RootPanel.get("zgwtest").clear();
				//Login l = new Login();
				
				
				 com.google.gwt.user.client.Window.Location.reload();
		
			return true;

		} else {
			MessageBox.alert("提示", "有未知的错误！", null);
		}
		return false;
	}

}
